home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch13 / Twist.cls < prev    next >
Text File  |  1999-06-20  |  820b  |  35 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "DistortTwist"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = False
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. Implements Distortion
  17.  
  18. ' The center about which to twist.
  19. Public cx As Single
  20. Public cz As Single
  21. Public period As Single
  22. Public offset As Single
  23.  
  24. ' Transform the point.
  25. Private Sub Distortion_Transform(X As Single, Y As Single, Z As Single)
  26. Dim theta As Single
  27.     
  28.     theta = (offset - Y) * 3.14 / period
  29.     
  30.     X = X * Cos(theta) - Z * Sin(theta)
  31.     Z = X * Sin(theta) + Z * Cos(theta)
  32. End Sub
  33.  
  34.  
  35.